const { Router } = require('express')
const express = require('express')
//路由容器
const orderNo = express.Router()
const axios = require('axios')
const { JsonWebTokenError } = require('jsonwebtoken')
const jwt = require("jsonwebtoken")
orderNo.get('/order/haveNoOrderCount', (req, res) => {
    let {userId}=req.query
   axios({
       method:'get',
       url : '/order/haveNoOrderCount',
       headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        token:req.session.token
    },
       params:{
        userId:jwt.decode(req.session.token).id
    }
   }).then(function(data){
       res.status(200).json({
           data:data.data,
           code:0
       })
   }).catch(function(err){
       console.log(err)
       res.status(500).json({
           msg:err
       })
   })
})
orderNo.get('/order/queryAllOrderNo', (req, res) => {
    let {pageNO,pageSize,userId}=req.query
   axios({
       method:'get',
       url : '/order/queryAllOrderNo',
       headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        token:req.session.token
    },
       params:{
        pageNO:pageNO,
        pageSize:pageSize,
        userId:jwt.decode(req.session.token).id
    }
   }).then(function(data){
       res.status(200).json({
           data:data.data,
           code:0
       })
   }).catch(function(err){
       res.status(500).json({
           msg:err
       })
   })
})
module.exports=orderNo;